<?php $total_receivables = 0;?>
<table class="datagrid" style="width:300px;">
  <thead class="datagrid">
    <tr>
      <th>
        Invoice Date
      </th>
      <th>
        Invoice#
      </th>
      <th>
        Terms
      </th>
      <th>
        Due Date
      </th>
      <th>
        Total Due
      </th>
    </tr>
  </thead>
  <tbody class="datagrid" style="height:auto;">
    <?php foreach($receivables as $receivable):?>
      <?php include_partial('invoice_list_item',array('receivable'=>$receivable,))?>
      <?php $total_receivables += $receivable['total'];?>
    <?php endforeach;?>
  </tbody>
  <tfoot class="datagrid">
    <tr>
      <td style="text-align:right;" colspan="4">Total</td>
      <td style="text-align:right;">
        <?php echo number_format($total_receivables,2) ?>
      </td>
    </tr>
  </tfoot>
</table>